home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MPW_TOOL
/
TOOLS
/
TOOLS_WI
/
ICON_8
/
TESTS
/
ENDETAB.ICN
< prev
next >
Wrap
Text File
|
1990-03-02
|
1KB
|
36 lines
# test type conversion and error handling in entab/detab
procedure main ()
s := "rutabaga"
if entab('1987') ~== "1789" then write ("oops 1")
if detab('1492') ~== "1249" then write ("oops 2")
if entab(" ","3") ~== "\t\t" then write ("oops 3")
if detab("\t\t","3") ~== " " then write ("oops 4")
ferr (103, entab, [])
ferr (103, detab, [])
ferr (103, entab, [[]])
ferr (103, detab, [[]])
ferr (101, entab, [s,2,3,&lcase])
ferr (101, detab, [s,4,5,&ucase])
ferr (210, entab, [s,7,4])
ferr (210, entab, [s,6,6])
ferr (210, detab, [s,8,5])
ferr (210, detab, [s,3,3])
end
# ferr(err,func,arglst) -- call func(args), verify that error "err" is produced
procedure ferr (err, func, args)
msg := "oops -- " || image(func) || "(" || image (val) || ") "
&error := 1
if func!args
then write (msg, "succeeded")
else if &error ~= 0
then write (msg, "failed but no error")
else if &errornumber ~= err
then write (msg, "got error ",&errornumber," instead of ",err)
&error := 0
return
end